package com.digitalart.futbol.hibernate.serviceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.digitalart.futbol.hibernate.dao.DuenioDao;
import com.digitalart.futbol.hibernate.ejb.Duenio;
import com.digitalart.futbol.hibernate.service.DuenioService;

@Service
public class DuenioServiceImpl implements DuenioService {

	@Autowired(required=true)
	private DuenioDao duenioDao;
	
	
	@Transactional
	public Duenio retriveDuenio(int id) {
		Duenio result = this.duenioDao.findById(id);
		return result;
	}
	
	@Transactional
	public Duenio createDuenio(Duenio duenio) {
		Duenio result = this.duenioDao.persistOnMerge(duenio);
		return result;
	}

	@Transactional
	public Duenio retriveDuenioByCed(String cedula) {
		Duenio result = this.duenioDao.getByCed(cedula);
		return result;
	}

	@Transactional
	public Duenio retriveDuenioByCorreo(String correo) {
		Duenio result = this.duenioDao.retriveDuenioByCorreo(correo);
		return result;
	}

}
